<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateMediasTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('medias', function (Blueprint $table) {
            $table->id();
            $table->bigInteger('member_id')->unsigned()->index()->comment('用户id');
            $table->char('type',5)->comment('素材类型（image=图片，video=视频）');
            $table->string('source',255)->comment('资源相对路径');
            $table->string('thumb',255)->comment('素材封面');
            $table->string('filename',100)->comment('文件名称');
            $table->integer('size')->unsigned()->comment('文件大小');
            $table->tinyInteger('status')->unsigned()->comment('素材状态(1=正常，2=转码中，3=审核，4=转码失败)');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('medias');
    }
}
